package com.example.studentstatusmanagement.mapper;

import com.example.studentstatusmanagement.pojo.Plot;
import com.example.studentstatusmanagement.pojo.PlotExample;
import java.util.List;

import com.example.studentstatusmanagement.pojo.doo.ReqRoom;
import com.example.studentstatusmanagement.pojo.dto.PlotInfo;
import com.example.studentstatusmanagement.pojo.dto.SRoom;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface PlotMapper {
    int countByExample(PlotExample example);

    int deleteByExample(PlotExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Plot record);

    int insertSelective(Plot record);

    List<Plot> selectByExample(PlotExample example);

    Plot selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Plot record, @Param("example") PlotExample example);

    int updateByExample(@Param("record") Plot record, @Param("example") PlotExample example);

    int updateByPrimaryKeySelective(Plot record);

    int updateByPrimaryKey(Plot record);

    @Select("select p.id,p.plotname as name from plot p where p.isdel = 0 and p.building_id = #{id}")
    List<PlotInfo> selectPlotsByBuildingId(Integer id);

    @Select("SELECT b.id as fid ,b.buildingname as name FROM building b where b.isdel = 0")
    List<ReqRoom> selectBuildingsForPlot();

    List<SRoom> selectPlots(ReqRoom reqRoom);
}